	//input an integer and print if it is a palindrome or not
	import java.util.*;
	
	public class PalindromeInt{
	  public static void main(String [] args){
	  try{
		  System.out.println("Please enter a number");
		  Scanner scan1=new Scanner(System.in);
		  int num= scan1.nextInt();	  
		  
	 
	  int n = num;
	  int rev=0;
	  System.out.println("Number: ");
	  System.out.println(" "+ num);
	  for (int i=0; i<=num; i++){
	  int remain=num%10;//remainder gives us the last number (12345%10 =5). Next time num is 1234
	  num=num/10;//gives the integer part ie if no.=12345 , result is 1234.5 without .5 as num is int type
	  rev=rev*10+remain;//0*10+5= 5
	  i=0;
	  }
	  System.out.println("After reversing the number: "+ " ");
	  System.out.println(" "+ rev);  
	  if(n == rev){
	  System.out.print("Number is palindrome!");
	  	  }
	  else{
	  System.out.println("Number is not palindrome!");
	 	  }
	  }
	  catch(Exception e){
	  System.out.println("Out of range!");
	  }
	  }
	} 

